#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <list>
#include <memory>
#include <complex>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include "include/newpool/threadpool.h"
#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <atomic>
#include <future>

int main()
{
    ThreadPool threadPool;
    threadPool.start(2);
    std::future<int> r1 = threadPool.submitTask([](int a, int b) -> int
                                                {std::this_thread::sleep_for(std::chrono::seconds(2));
                                                     return a + b; }, 100, 200);
    std::future<int> r2 = threadPool.submitTask([](int a, int b) -> int
                                                { std::this_thread::sleep_for(std::chrono::seconds(2));
                                                    return a + b; }, 100, 200);
    std::future<int> r3 = threadPool.submitTask([](int a, int b) -> int
                                                { return a + b; }, 100, 200);
    std::future<int> r4 = threadPool.submitTask([](int a, int b) -> int
                                                { return a + b; }, 100, 200);
    std::future<int> r5 = threadPool.submitTask([](int a, int b) -> int
                                                { return a + b; }, 100, 200);
    std::cout << r1.get() << std::endl;
    std::cout << r2.get() << std::endl;
    std::cout << r3.get() << std::endl;
    std::cout << r4.get() << std::endl;
    std::cout << r5.get() << std::endl;
    return 0;
}